﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PictureList.aspx.cs" Inherits="background.Manager.Enterprise.Album.list" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>图片管理</title>
    <link href="../../Styles/index.css" rel="stylesheet" />
    <script src="../../Scripts/jquery-1.8.2.min.js"></script>
    <script src="../../Scripts/layer/layer.js"></script>

    <link href="Js/jquery.uploadify-v2.1.0/uploadify.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="Js/jquery.uploadify-v2.1.0/swfobject.js"></script>
    <script type="text/javascript" src="Js/jquery.uploadify-v2.1.0/jquery.uploadify.v2.1.0.min.js"></script>

    <script type="text/javascript">
        function changeOrder(obj) {
            $.post("Action/album.ashx", { action: "changeOrder", order: $(obj).val(), id: $(obj).attr("data-id") }, function (ret) {
                if (!ret) {
                    layer.msg("排序保存失败");
                }
            })
        }
        function deletes(_id) {
            if (confirm("确定要删除吗？")) {
                $.post("Action/album.ashx", { action: "delete", id: _id }, function (ret) {
                    if (ret) {
                        layer.msg("删除成功，2秒后自动刷新页面", { icon: 1, time: 2000 }, function () { window.location.reload(); });
                    } else {
                        layer.msg("对不起删除失败，稍后再试", { icon: 2 });
                    }
                })
            }
        }
        function checkboxAll(obj) {
            $("input[name='idbox']").attr("checked", $(obj).is(":checked"));
        }
        $(document).ready(function () {
            $("#uploadify").uploadify({
                'uploader': 'Js/jquery.uploadify-v2.1.0/uploadify.swf',
                'script': 'Action/UploadHandler.ashx',
                'cancelImg': 'Js/jquery.uploadify-v2.1.0/cancel.png',
                'folder': '/Albums',
                'queueID': 'fileQueue',
                'auto': false,
                'multi': true
            });
        });
    </script>
    <style type="text/css">
        .ablum_warp { padding: 8px; margin-right: 8px; width: 200px; float: left; border: 1px solid #fff; }
        .number { position: absolute; margin-top: 110px; padding: 8px; font-size: 18px; text-align: right; width: 180px; }
        .cover { max-width: 200px; height: 150px; border: 1px solid #ccc; }
        .ablumName { padding-top: 6px; display: block; }
    </style>
</head>
<body>
    <div class="top">
        <strong>图片管理</strong>
        <span style="float: right"><a href="javascript:history.back();">
            <img src="../../Images/bak.png" />后退</a></span>
    </div>
    <div class="main">

        <div id="fileQueue"></div>
        <input type="file" name="uploadify" id="uploadify" />
        <p>
            <a href="javascript:$('#uploadify').uploadifyUpload()">上传</a>| 
        <a href="javascript:$('#uploadify').uploadifyClearQueue()">取消上传</a>
        </p>

        <div>
            <div class="tool_search">
                <input type="button" class="sbtn" value="上传图片" onclick="" />
            </div>
            <%System.Data.DataTable dt= Codes.Album.getList(int.Parse(string.IsNullOrEmpty(Request["p"])?"1":Request["p"]), 10); %>
            <% int j=1; foreach(System.Data.DataRow dr in dt.Rows) {%>
            <div class="ablum_warp">
                <div class="cover">
                    <a href="PictureList.aspx?AlbumID=<%=dr["ID"] %>">
                        <img src="<%=dr["Cover"] %>" /></a>
                    <div class="number">
                        <a href="AddGroup.aspx?actionType=update&id=<%=dr["id"] %>" title="编辑图片">
                            <img src="../../Images/edit.png" class="tool_edit" /></a>
                        <a href="javascript:void(0);" onclick="deletes(<%=dr["id"] %>)" title="删除图片">
                            <img src="../../Images/delete.png" class="tool_delete" /></a>&nbsp;<span><%=dr["PicCount"] %></span>
                    </div>
                </div>
                <strong class="ablumName"><a href="PictureList.aspx?AlbumID=<%=dr["ID"] %>"><%=dr["Name"] %></a></strong>
            </div>
            <% } %>
            <div style="clear: both"></div>
            <div class="tcdPageCode"></div>
            <script src="../../Scripts/jquery.page.js"></script>
            <script>
                $(".tcdPageCode").createPage({
                    pageCount: '<%=Math.Ceiling((double)Codes.Links.getListCount()/10)%>',
                    current: '<%=string.IsNullOrEmpty(Request["p"])?"1":Request["p"]%>',
                    backFn: function (p) {
                        window.location.href = "?p=" + p;
                    }
                });
            </script>
        </div>
    </div>
    <!--#include file='../../Include/footer.html'-->
</body>
</html>
